<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>填写信息</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="/zhenze/Public/home/css/reset.css"/>
		<link rel="stylesheet" href="/zhenze/Public/home/css/tianxiexinxi.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/font-awesome.min.css" />
        
	</head>
	<body>
		<div class="top">
			<a href="javascript:history.go(-1);"><i class="fa fa-angle-left"></i></a>
			<p>填写信息</p>
		</div>
		<p class="pp">应工信部要求，入网用户需如实填写个人信息。</p>
        
        <form name="seachform" id="seachform" action="<?php echo U('index/fillinfo');?>" method="post">
			<ul class="seachform">
				<li><p>姓名</p><input type="text" name="info[name]" datatype="z2-4" errormsg="真实姓名必须是2至4个汉字"/></li>
				<li><p>电话</p><input type="text" id="mobile" name="info[mobile]" datatype="/^(\d{11})$/" errormsg="手机号号必须是11位位数字"/>
				<button class="btn" onclick="return sendCode(this);">短信验证</button> </li>
				<li><p>验证码</p><input type="text" name="checkcode" datatype="n2-6" errormsg="请输入短信验证码" /></li>
				<li><p>身份证</p><input type="text" name="info[idcard]" datatype="/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/" errormsg="15位或18位，如果是15位，必需全是数字，如果是18位，最后一位可以是数字或字母Xx，其余必需是数字"/></li>
				<li><p>学校</p><input id="text0" name="school" type="text" placeholder="输入您的学校"  /></li>
			</ul>
			<input id="school" name="info[school_id]" type="hidden"  />
			<input id="setmeal_id" name="info[setmeal_id]" type="hidden" value="<?php echo ($setmeal_id); ?>" />
			<input id="new_mobile" name="info[new_mobile]" type="hidden" value="<?php echo ($new_mobile); ?>" />
			
			<button  class="btnn" onClick="$('#seachform').submit();">下一步</button>	
		</form>

		<script src="/zhenze/Public/home/js/screenSize.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript" src="/zhenze/Public/home/js/jquery-3.1.1.min.js" ></script>

		<link rel="stylesheet" type="text/css" href="/zhenze/Public/jquery-ui/jquery-ui.css"></link>
		<script type="text/javascript" src="/zhenze/Public/jquery-ui/jquery-ui.js"></script>

		<link href="/zhenze/Public/validform/Validform.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="/zhenze/Public/validform/Validform_v5.3.2.js"></script>
		<script type="text/javascript" src="/zhenze/Public/validform/Validform_Datatype.js"></script>
        
	</body>
</html>
<script>
	$(function(){
		$("#seachform").Validform({
			tiptype:1
		});
		
	});
	$(function(){
		$( "#text0" ).autocomplete({
			source: function(request,response) {
				$.ajax({
					url: "<?php echo U('index/getschool');?>",
					dataType: "json",
					data: {
						key: request.term
					},
					success: function( data ) {
						response( data );
					}
				});
			},
			minLength: 1,
			autoFocus: true,
			select: function( event, ui ) {
				//console.log(ui);
				$("#school").val(ui.item.id);
			}
		});
	} );
	
	var clock = '';
	var nums = 60;
	var btn;
	var btnable = 1;
	function sendCode(thisBtn){ 
		btn = thisBtn;
		btnable=0; //将按钮置为不可点击
		$(btn).html(nums+'秒后..');
		clock = setInterval(doLoop, 1000); //一秒执行一次
		var mobile=$("#mobile").val();
		if(mobile.length==0){
			alert("请先输入手机号码");
			$("#mobile").focus();
			clearInterval(clock); //清除js定时器
			btnable=1;
			$(btn).html('短信验证');
			nums = 60; //重置时间
		}else{
			$.ajaxSettings.async = false;
			$.getJSON("<?php echo U('index/sendcode');?>&mobile="+mobile,function(result){
				if(result.flag=1){	//发送成功
					//
				}else{	//发送失败
					clearInterval(clock); //清除js定时器
					btnable=1;
					$(btn).html('短信验证');
					nums = 60; //重置时间
				}
			});
		}
		return false;
	}
	function doLoop(){
		nums--;
		if(nums > 0){
			$(btn).html(nums+'秒后..');
		}else{
			clearInterval(clock); //清除js定时器
			btnable=1;
			$(btn).html('短信验证');
			nums = 60; //重置时间
		}
	}
  
</script>